package com.abcdefg.rabbitmqextensionsdemo.listener;

import com.abcdefg.rabbitmqextensionsdemo.constants.Constant;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.Date;

@Component
public class DelayListener {
    @RabbitListener(queues = Constant.DELAY_QUEUE)
    public void delayListen(Message message) throws IOException {
        System.out.printf("[delay.queue] %tc 接收到的消息：%s\n", new Date(),new String(message.getBody()));
    }
}
